package sdk3.components.DataGrid.DGColumnSuperSort
{
	/** NOT WORKING YET! NOT FULLY IMPLEMENTED YET! BECAUSE SORT FUNCTION IS NOT FULLY IMPLEMENTED YET! **/
	import sdk3.c_VALIDATORS;
	
	import mx.controls.dataGridClasses.DataGridColumn;
	
	public class DGColumnSuperSort extends DataGridColumn
	{
		public function DGColumnSuperSort(columnName:String=null)
		{
			super(columnName);
			// this.addEventListener(DataGridEvent.HEADER_RELEASE, sortByColumn);
		}

		public var SORT_MODE:Array = new Array();

		/** auto detects the sort mode:
		 * if a date is present in the column to sort and chooses the appropriate sorting-algorithm
		 * GERMAN-FORMAT: DD.MM.YYYY
		 * MYSQL-FORMAT: YYYY-MM-DD
		 * US-FORMAT: MM/DD/YYYY
		 * **/
/*		public function sortByColumn(event):void
		{
			var index:int = event.columnIndex;
			var DGCOLUMN:DataGridColumn = columns[index];
			var ASC_DSC:String = '';
			
			// check out the first 3 elements to determine what sort mode to choose
			var EXIBITION_LIMIT:int = 3;
			if(EXIBITION_LIMIT > this.dataProvider.source.length)
			{
				EXIBITION_LIMIT = this.dataProvider.source.length;
			}
			
			for(var counter:int = 0;!(counter == EXIBITION_LIMIT);counter++)
			{
				// NUMBER
				var VALUE:String = this.dataProvider.source[DGCOLUMN.dataField];
				if(c_VALIDATORS.singleton().isInt(VALUE) || c_VALIDATORS.singleton().isNumber(VALUE))
				{
					SORT_MODE.push('NUMBER');
				}
					// DATE
				else if(DateField.stringToDate(VALUE,'DD.MM.YYYY') != null)
				{
					SORT_MODE.push('DATE GERMAN');
				}
				else if(DateField.stringToDate(VALUE,'YYYY-MM-DD') != null)
				{
					SORT_MODE.push('DATE MYSQL');
				}
				else if(DateField.stringToDate(VALUE,'MM/DD/YYYY') != null)
				{
					SORT_MODE.push('DATE US');
				}
				else
				{
					// STRING
					SORT_MODE.push('STRING');
				}
			}
		}
*/	}
}